package com.wetao.lib_common.greendao.model;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.NotNull;
import org.greenrobot.greendao.annotation.ToMany;

import java.util.List;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Unique;

import com.wetao.lib_common.greendao.dao.DaoSession;
import com.wetao.lib_common.greendao.dao.AssistantQuestionDao;
import com.wetao.lib_common.greendao.dao.ExamListenDao;
import com.wetao.lib_common.greendao.dao.PagePictureDao;
import com.wetao.lib_common.greendao.dao.AssistantExamDao;

@Entity
public class AssistantExam {
    public void setPictureList(List<PagePicture> pictureList) {
        this.pictureList = pictureList;
    }

    public void setListenList(List<ExamListen> listenList) {
        this.listenList = listenList;
    }

    public void setQuestionList(List<AssistantQuestion> questionList) {
        this.questionList = questionList;
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Integer getExamId() {
        return this.examId;
    }

    public void setExamId(Integer examId) {
        this.examId = examId;
    }

    public String getExamName() {
        return this.examName;
    }

    public void setExamName(String examName) {
        this.examName = examName;
    }

    public Integer getPublishId() {
        return this.publishId;
    }

    public void setPublishId(Integer publishId) {
        this.publishId = publishId;
    }

    public String getBeginTime() {
        return this.beginTime;
    }

    public void setBeginTime(String beginTime) {
        this.beginTime = beginTime;
    }

    public String getFinishTime() {
        return this.finishTime;
    }

    public void setFinishTime(String finishTime) {
        this.finishTime = finishTime;
    }

    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Generated(hash = 1116811004)
    public List<PagePicture> getPictureList() {
        if (pictureList == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            PagePictureDao targetDao = daoSession.getPagePictureDao();
            List<PagePicture> pictureListNew = targetDao
                    ._queryAssistantExam_PictureList(id);
            synchronized (this) {
                if (pictureList == null) {
                    pictureList = pictureListNew;
                }
            }
        }
        return pictureList;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 727962153)
    public synchronized void resetPictureList() {
        pictureList = null;
    }

    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Generated(hash = 1225012652)
    public List<ExamListen> getListenList() {
        if (listenList == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            ExamListenDao targetDao = daoSession.getExamListenDao();
            List<ExamListen> listenListNew = targetDao
                    ._queryAssistantExam_ListenList(id);
            synchronized (this) {
                if (listenList == null) {
                    listenList = listenListNew;
                }
            }
        }
        return listenList;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 1330517094)
    public synchronized void resetListenList() {
        listenList = null;
    }

    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Generated(hash = 268294673)
    public List<AssistantQuestion> getQuestionList() {
        if (questionList == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            AssistantQuestionDao targetDao = daoSession.getAssistantQuestionDao();
            List<AssistantQuestion> questionListNew = targetDao
                    ._queryAssistantExam_QuestionList(id);
            synchronized (this) {
                if (questionList == null) {
                    questionList = questionListNew;
                }
            }
        }
        return questionList;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 1378007343)
    public synchronized void resetQuestionList() {
        questionList = null;
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 917727117)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getAssistantExamDao() : null;
    }

    @Id(autoincrement = true)
    private Long id;
    //试卷id
    @NotNull
    @Unique
    private Integer examId;
    //试卷名称
    private String examName;
    //布置id
    private Integer publishId;


    private String beginTime; //自己管理
    private String finishTime; //自己管理


    @ToMany(referencedJoinProperty = "assistantExamId")
    List<PagePicture> pictureList;

    @ToMany(referencedJoinProperty = "assistantExamId")
    List<ExamListen> listenList;

    @ToMany(referencedJoinProperty = "assistantExamId")
    List<AssistantQuestion> questionList;
    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /** Used for active entity operations. */
    @Generated(hash = 246202328)
    private transient AssistantExamDao myDao;

    @Generated(hash = 867804182)
    public AssistantExam(Long id, @NotNull Integer examId, String examName,
            Integer publishId, String beginTime, String finishTime) {
        this.id = id;
        this.examId = examId;
        this.examName = examName;
        this.publishId = publishId;
        this.beginTime = beginTime;
        this.finishTime = finishTime;
    }

    @Generated(hash = 139357322)
    public AssistantExam() {
    }


}
